<script type="text/javascript">  
    <?php $jsonStr = json_encode($this->inspector, JSON_UNESCAPED_SLASHES); ?>
    var store = new dojo.data.ItemFileReadStore({data: <?php echo "{'identifier':'json_id','label':'name','items':$jsonStr}"; ?>});
</script>
<!--<div dojoType="dojo.data.ItemFileReadStore" jsId="store" url="/default/json/inspector" />-->

<div dojoType="dijit.tree.ForestStoreModel" jsId="branchModel" store="store" query="{type:'Branch'}" childrenAttrs="children" />
<div dojoType="dijit.Tree" id="branchInspector" model="branchModel" autoExpand="false" openOnClick="false" showRoot="false">
    <script type="dojo/method" event="onClick" args="item">
        parent.main.location.href = item.url;
    </script>
    <script type="dojo/method" event="getIconClass" args="item, opened">
        return (item.type + ' ' + item.color + item.type + ' ' + item.type + item.id);
    </script>
</div>


<div dojoType="dijit.tree.ForestStoreModel" jsId="lineModel" store="store" query="{type:'Line'}" childrenAttrs="children" />
<div dojoType="dijit.Tree" id="lineInspector" model="lineModel" autoExpand="false" openOnClick="false" showRoot="false">
    <script type="dojo/method" event="onClick" args="item">
        parent.main.location.href = item.url;
    </script>
    <script type="dojo/method" event="getIconClass" args="item, opened">
        return (item.type + ' ' + item.color + item.type + ' ' + item.type + item.id);
    </script>
</div>

<style type="text/css">
    <?php $nodes = array('Line' => 24, 'Program' => 22, 'Product' => 22, 'Branch' => 24, 'Agency' => 22) ?>
    <?php $colors = array('green', 'yellow', 'orange', 'red') ?>
    
    <?php foreach($nodes as $node => $size): ?>
        .<?php echo $node ?> { width: <?php echo $size ?>px; height: <?php echo $size ?>px; background-image: url(../../css/icon/inspector/<?php echo $node ?>.png); }
        <?php foreach($colors as $color) : ?>
        .<?php echo $color ?><?php echo $node ?> { background-image: url(../../css/icon/inspector/<?php echo $color ?><?php echo $node ?>.png); }
        <?php endforeach;  ?>
    <?php endforeach; ?>
    
    .Officer {  width: 28px; height: 30px; box-shadow: 0px 0px 0px #abc; border: 1px solid #bcd; }
    <?php foreach ($this->inspector as $item) : ?>
        <?php if($item['type'] == 'Officer') : ?>
           .Officer<?php echo $item['id'] ?> { background-image: url(/default/photo/thumb/cat/u/id/<?php echo $item['id'] ?>/pf/<?php echo $item['color'] ?>); }
        <?php endif; ?>
    <?php endforeach; ?>
</style>